import { Component, OnInit, ViewChild, ViewContainerRef, ComponentRef, ComponentFactoryResolver, EventEmitter } from '@angular/core';
import * as _ from 'lodash';
import { FundEntryPageComponent } from "../../content/fund-entry-page/fund-entry-page.component";

@Component({
  selector: 'app-fund-entry',
  templateUrl: './fund-entry.component.html',
  styleUrls: ['./fund-entry.component.scss']
})
export class FundEntryComponent implements OnInit {

 // 模版
 @ViewChild("qdiiFundEntryPage", { read: ViewContainerRef })
 qdiiFundEntryPage: ViewContainerRef;
 fundEntryPageComponent: ComponentRef<FundEntryPageComponent>;
 constructor(
   public resolver: ComponentFactoryResolver,
 ) { }

 ngOnInit() {
   if (this.fundEntryPageComponent && this.fundEntryPageComponent.instance) {
     this.fundEntryPageComponent.destroy();
   }
   const viewPageComponent = this.resolver.resolveComponentFactory(FundEntryPageComponent);
   this.fundEntryPageComponent = this.qdiiFundEntryPage.createComponent(viewPageComponent);
 }
}
